package com.github.dabai.aggregation;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class AggregationField<I extends IAggregatingInput> implements IAggregating<I> {
	protected AggregationFieldResult result;
	protected IAggregation<I> aggregation;

	public AggregationField(String name, Object result, IAggregation<I> aggregation) {
		this.result = new AggregationFieldResult(name, result);
		this.aggregation = aggregation;
	}

	@Override
	public void aggregating(I input) {
		aggregation.aggregation(input, result);
	}

	public String getName() {
		return result.getName();
	}

	public Object getResult() {
		return result.getResult();
	}
}
